<?php
$this->LoadHelper('MemberHelper');
$MemberHelper = new MemberHelper();
/*
$ajax = $this->Param['ajax'];
$page = isset($this->Param['page']) ? $this->Param['page'] : 1;
$rp = isset($this->Param['rp']) ? $this->Param['rp'] : PAGE_SIZE;
if ($ajax) {
    $this->LoadHelper('RoleHelper');
    $RoleHelper = new RoleHelper();
    $where = array(
        '`r_status` = ?' => 'ok'
    );
    $data = $RoleHelper->roleList($where, $page, $rp, $this->Param);
    $json_data = array('total' => $data['count'], 'rows' => array());
    foreach ($data['all'] AS $rowNum => $row) {
        $row['op'] = '<a href="javascript:;" class="J-department" data-id="'.$row['dp_id'].'">管理用户</a>';
        $json_data['rows'][] = $row;
    }
    echo json_encode($json_data);
} else {
    $member_info = $MemberHelper->getMember($this->UserConfig['Id']);
    $this->Assign('member_info', $member_info);
    echo $this->GetView('index.php');
}*
 * 
 */

$this->LoadHelper('RoleHelper');
$RoleHelper = new RoleHelper();

$this->LoadHelper('PurviewListHelper');
$PurviewListHelper = new PurviewListHelper();

if(empty($this->Param['option'])){
    $where = array(
        '`r_status` = ?' => 'ok'
    );
    $role_data = $RoleHelper->roleAll($where);
    if(!empty($role_data)) foreach($role_data as $k => $v){
        $arr = unserialize($v['r_role']);
        if(!empty($arr)){
            $role_data[$k]['r_role'] = implode(',', $arr);
        }else{
            $arr = array();
        }
    }
    $this->Assign('role', $role_data);
    
    $role_packer = $RoleHelper->packAll(array(
        '`p_status` = ?' => 'ok'
    ));
    if(!empty($role_packer)) foreach($role_packer as $k => $v){
        $arr = unserialize($v['p_role']);
        if(!empty($arr)){
            $role_packer[$k]['p_role'] = implode(',', $arr);
        }else{
            $arr = array();
        }
    }
    $this->Assign('packer', $role_packer);
    
    $purview = $PurviewListHelper->GetAll();
    $this->Assign('purview', $purview);
    
    $member_info = $MemberHelper->getMember($this->UserConfig['Id']);
    $this->Assign('member_info', $member_info);
    echo $this->GetView('index.php');
}else{
    
}